package com.regtwo.admin.sqlapp;

import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

public class QueryActivity extends AppCompatActivity {
    ListView lv;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_query);

        Uri uri = Uri.parse("content://gtq.cn/users");
        Cursor c = getContentResolver().query(uri, null, null, null, null);
        while (c.moveToNext()){
            String uname=c.getString(0);
            int id=c.getInt(c.getColumnIndex("id"));
            Log.i("gtq-2", "uanmemmmm:" + uname + "........" + id);
        }
        Log.i("gtq-3",c.getColumnName(0));
        ListAdapter adapter = new SimpleCursorAdapter(this,android.R.layout.simple_list_item_1,c,
                new String[]{c.getColumnName(0)},new int[]{},0);


    }

    public void back(View view) {
        this.onDestroy();
    }
}
